package com.zxy.model;

import com.zxy.enums.CategoryStatus;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
//@AllArgsConstructor
//@NoArgsConstructor
public class Category extends BaseModel{
    private Integer id;
    private String name;
    private String img;
    private Integer seq;
    private Integer parentId;
    private Integer status;
    private String statusX;

    public String getStatusX() {
//        先拿 CategoryStatus 里面的一个静态方法 findByCode
//        如果不为空，直接返回getMsg,为空，则返回空
        CategoryStatus categoryStatus = CategoryStatus.findByCode(this.getStatus());
        if(categoryStatus != null){
            return categoryStatus.getMsg();
        }
        return "";
//这时候我们的接口就会多一个statusX

//        return statusX;
    }


}
